
package com.medical.controller.diseasecontroller;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.github.pagehelper.PageHelper;
import com.medical.pojo.DiseaseInfo;
import com.medical.pojo.PageDisease;
import com.medical.service.DiseaseInfoService;


//测试连接
@Controller
public class DiseaseController {
	//12334
	@Autowired
	private DiseaseInfoService diseaseInfoService;
	
	@ResponseBody
	@RequestMapping(value="queryAlldiseaseInfo/{pageindex}",method = RequestMethod.GET)

	public PageDisease queryAlldiseaseInfo(@PathVariable("pageindex") String index,String disease) {
		PageHelper.startPage(Integer.parseInt(index),5);
		
		 PageDisease pageDisease = diseaseInfoService.queryAllDiseaseinfo(disease);
		
		return pageDisease;
	}
	
	@RequestMapping(value="/updatediseaseInfo")
	public void updatediseaseInfo(DiseaseInfo diseaseinfo) {
		
		diseaseInfoService.updateDiseaseInfo(diseaseinfo);
		
	}
	
	@ResponseBody
	@RequestMapping(value="/deletediseaseInfo/{id}")
	public int deletediseaseInfo(@PathVariable("id") String id) {
		
		return diseaseInfoService.deleteDiseaseInfo(id);
	}
	
	@ResponseBody
	@RequestMapping(value="/insertDiseaseInfo")
	public int insertDiseaseInfo(DiseaseInfo diseaseinfo) {
		System.out.println(diseaseinfo);
		return diseaseInfoService.insertDiseaseInfo(diseaseinfo);
	}

}
